<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    var ff=prompt("请输入一个数字");
    
    function method(num){
       for(var a=2;a<num;a++){
           if(num % a == 0){
            return num+"不是质数";
           }
 
       }
       return num+"是质数";
    }
    alert(method(ff));
</script>